<?php
namespace plugin\videoappdownload\model; 
use think\Model;
use think\facade\Db; 
class PluginVideoappdownloadAd extends Model
{
    
    
 
      public function finds($map,$field)
     { 
   
         if ($field) {
            $finds = PluginvideoappdownloadAd::where($map)->field($field)->findOrEmpty();
         } else {
             $finds = PluginvideoappdownloadAd::where($map)->findOrEmpty();
         }
         return $finds;
     }
      public function paginate($map,$field,$order,$page)
     {
   
 
      $list = PluginvideoappdownloadAd::where($map)->order($order)->field($field)->paginate($page);
 

      $data['list']=$list;
      
      return $data; 
     }
      public function adds($request,$field)
     { 
        $request['create_time'] = time();
     	
         unset($request['id']);
         $adds = new PluginvideoappdownloadAd;
         $adds->save($request);
         return $adds->id;
     }
     public function updates($map,$request,$field)
     { 
    	
     $save = PluginvideoappdownloadAd::where($map)->find();  
    if ($save) {
      if ($field) {
          return $save->allowField($field)->save($request); 
      } else {
          return $save->save($request); 
      }      
     }  
       return false;  
     }
       public function dels($map)
     {
  	 
      $dels = PluginvideoappdownloadAd::where($map)->find();  
      if ($dels) {
            return PluginvideoappdownloadAd::where($map)->delete();
      }  
        return false;  
     }
     //模型方法


}